package com.ara.project_common.data.api;

import android.content.Context;

import com.alibaba.android.arouter.launcher.ARouter;

import java.util.List;

/**
 * Created by XieXin on 2022/2/18.
 * 路由API
 */
public class CommonRouterApi {
    /*** 主页 */
    public static final String API_MAIN = "/main/Main";

    /*** 登录 */
    public static final String API_LOGIN = "/account/login";

    /*** Web */
    public static final String API_WEB = "/web/web";

    /*** 大图查看 */
    public static final String API_LARGE_PICTURE_VIEW = "/common/LargePictureViewActivity";

    /**
     * 跳转到主页
     */
    public static void jumpMainActivity(Context context) {
        ARouter.getInstance()
                .build(API_MAIN)
                .navigation(context);
    }

    /**
     * 跳转到登录页
     */
    public static void jumpLoginActivity(Context context) {
        ARouter.getInstance()
                .build(API_LOGIN)
                .withBoolean("isReLogin", false)
                .navigation(context);
    }

    /**
     * 跳转到登录页
     */
    public static void jumpReLoginActivity(Context context) {
        ARouter.getInstance()
                .build(API_LOGIN)
                .withBoolean("isReLogin", true)
                .navigation(context);
    }

    /**
     * 跳转到Web
     */
    public static void jumpWebActivity(Context context, String url) {
        ARouter.getInstance()
                .build(API_WEB)
                .withString("url", url)
                .navigation(context);
    }

    /**
     * 跳转到大图查看
     */
    public static void jumpLargePictureViewActivity(Context context, List<String> images, int index) {
        ARouter.getInstance()
                .build(API_LARGE_PICTURE_VIEW)
                .withObject("images", images)
                .withInt("index", index)
                .navigation(context);
    }
}
